// 导出h5 widget(component)
const widgetComponent = {
  layouts: [],
  settings: []
};

const widgetFiles = require.context('./', true, /Layout.vue$/);
const settingFiles = require.context('./', true, /Setting.vue$/);

widgetFiles.keys().forEach((k) => {
  new RegExp(/^\.\/(.*)\/(.*)Layout\.vue$/).test(k);
  const name = RegExp.$1;
  widgetComponent.layouts[name] = widgetFiles(k).default;
});

settingFiles.keys().forEach((k) => {
  new RegExp(/^\.\/(.*)\/(.*)Setting\.vue$/).test(k);
  const name = RegExp.$1;
  widgetComponent.settings[name] = settingFiles(k).default;
});

export default widgetComponent;
